package com.frank.game.tool;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

public class GetProperties {

	private static Properties prop = null;
    static{
        prop = new Properties();
        //设置properties文件路径,以src为根路径(config.properties 处于src根目录下)
        InputStream in = GetProperties.class.getResourceAsStream("/config/config.properties");
        try {
            prop.load(in);
        } catch (IOException e) {
            System.out.println("读取配置文件失败---->>>>----(/src/config/config.properties)");
            e.printStackTrace();
        }
    }
     
    /**
     * 根据传入的KEY获取配置文件中对应的值
     * @param key
     * @return
     */
    public static String getPropertieValue(String key){
        String value = "";
        value = prop.getProperty(key).trim();    
        return value;
    }
}
